<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/util_file/common.jspf"%>  
<%@ taglib prefix="elfunc" uri="/WEB-INF/el-functions.tld"%>
<style>
#replyList{text-align: left;margin:0; padding:0; list-style: none;}
#replyList li{text-align: left;margin:0; padding:0;}
</style>
<script type="text/javascript" src="/jeons/js/jquery.nyroModal.custom.js"></script>
<link rel="stylesheet" href="/jeons/css/nyroModal/nyroModal.css" type="text/css" media="screen" />
<script type="text/javascript">
	$(document).ready( function(){
		$(".nm").nm({
			sizes : {
				minW : 400,
				maxW : 500,
				minH : 30,
				maxH : 30
			}
		});
		
		//리스트 가기
		$("#BtnList_review").click(function(){
			$("#qna_bdno").each(function(){
				$.get('/jeons/review/index?bdno='+$("#qna_bdno").val(), function(data){
					$("#subpage_review").replaceWith(data);
				});
			 });
		});
		
		
		
		//리플달기
		$("#BtnReplySubmit").click( function(){
			 $.post('/jeons/review/replyInsert',$("#re_reply").serialize(),function(data){
				 
				 
				/*  var tmp = "<tr> <td colspan='3'>"+data.content+"</td><td>"+data.u_id+"</td></tr>" +
				 			" <tr><td colspan='4' bgcolor='#000000'></td></tr>";
				 			
				 			
							
				 var tmep = '<li><b>'+data.u_id+'</b>'+data.stringdate+'<br>'+
							''+data.content+'<button type="button" name="BtnDeleteReply" u_id="'+data.u_id+'" re_reno="'+data.re_reno+'">삭제</button><br>'+
							'-------------------------------------------------------------------------------------------------------------------'+
							'</li>';
							
				 			
				 $('#replyList li:eq(0)').before(tmep); */
				 /* 패치 */
			/* 	 $("#replyList").prepend($("<li/>").html(
					"<b>"+data.u_id+"</b>"+data.stringdate+"<br>"+data.content+"\t").append(	
				$("<input/>").attr("type","button").attr("name","BtnDeleteReply").attr("u_id",data.u_id).attr("re_reno",data.re_reno).attr("value","삭제"))); 
				  */
				 
				
$("#replyList").prepend($("<li/>").html("<b>"+data.u_id+"</b>"+data.stringdate+"<br>"+data.content+"<div align='right'> <input type='button' name='BtnDeleteReply' re_reno='"+data.re_reno+"' u_id='"+data.u_id+"'  value='삭제'/></div>"));
				  
				 
				 
			 });
		});
		
		//리플삭제
		$("[name=BtnDeleteReply]").live('click', function(){
			//if (!confirm($(this).attr('u_id') + "님 \n 리플을 삭제 하시겠습니까?")) return ;
			/* var obj = $(this); */
		  $(this).parent().parent().remove();
			//var re_reno = $(this).attr('re_reno');
			/* $.post('/jeons/review/replyDelete?re_reno='+re_reno, function(data){
				if (data == 'true') {
					alert('삭제 되었습니다.');
				}else{
					alert('운영자에게 문의하여 주세요');
				}

				$(obj).parent.parent("li").remove();
			});
			
		});  */
		});
	
	});
</script>
<div id="subpage_review">
<table border="0" width="650px" height="50">
	<tr>
		<td colspan="4" bgcolor="#000000" height="1"></td>
	</tr>
	<tr>
		<th height="24" align="center">제목</th>
		<td colspan="3" width="400px">${data.title} </td>
	</tr>
	<tr>
		<td colspan="4" bgcolor="#ffffff" height="1"></td>
	</tr>
	<tr>
		<th height="24" align="center">유저아이디</th>
		<td colspan="3">${data.u_id}</td>
	</tr>
	<tr>
		<th height="24" align="center">점수</th>
		<td colspan="3">
		<c:if test="${data.score == 'one'}">
			<font color="red">★</font>
			</c:if>
			<c:if test="${data.score == 'two'}">
			<font color="red">★★</font>
			</c:if>
			<c:if test="${data.score == 'three'}">
			<font color="red">★★★</font>
			</c:if>
			<c:if test="${data.score == 'four'}">
			<font color="red">★★★★</font>
			</c:if>
			<c:if test="${data.score == 'five'}">
			<font color="red">★★★★★</font>
			</c:if>
			<c:if test="${data.score == null}">
			입력되지않음
			</c:if>
		
		</td>
	</tr>
	<tr>
		<td colspan="4" bgcolor="#ffffff" height="1"></td>
	</tr>
	<tr>
		<td colspan="4" bgcolor="#ffffff" height="1"></td>
	</tr>
	<tr>
		<th colspan="4" height="4" align="center">내용</th>
	</tr>
	<tr>
		<td colspan="4" bgcolor="#ffffff" height="1"></td>
	</tr>
	<tr>
		<td colspan="4" bgcolor="#ffffff" height="1">
			${data.content}
		</td>
	</tr>
	<tr>
	<tr>
		<td colspan="4" bgcolor="#000000" height="1"></td>
	</tr>
</table>
<div align="right">
	<a href="/jeons/review/checkpasswd?reno=${data.reno}&board_type=modify" class="nm"><button type="button" id="BtnModify">수정</button></a>
	<a href="/jeons/review/checkpasswd?reno=${data.reno}&board_type=delete" class="nm"><button type="button" id="BtnModify">삭제</button></a>
	<button type="button" id="BtnList_review">리스트</button>
</div>
<br>
<form:form commandName="re_reply" method="post" id="re_reply">
<form:hidden path="u_id" value="amok87"/>
<form:input path="reno" value="${data.reno}"/>
<table border="0" width="650px" cellpadding="0" cellspacing="1" bgcolor="yellow">
	<tr>
		<td colspan="4" bgcolor="#000000" height="1"></td>
	</tr>
	<tr>
		<td colspan="3"><form:textarea path="content" cols="80" rows="1"/></td>
		<td><button type="button" id="BtnReplySubmit">확인</button></td>
	</tr>
	<tr>
		<td colspan="4" bgcolor="#000000" height="1"></td>
	</tr>
	<tr>
		<td colspan="4" bgcolor="#ffffff" height="1"></td>
	</tr>
</table>
</form:form>
<div align="left">
	<ul id="replyList">
	<c:forEach items="${data_reply}" var="item">
	<li><b>${item.u_id}</b><fmt:formatDate value="${item.regdt}" pattern="yyyy-MM-dd HH:mm:ss"/><br>
		${item.content}
	<div align="right"><button type="button" name="BtnDeleteReply" u_id="${item.u_id}" re_reno="${item.re_reno}">삭제</button></div>
	</li>
	</c:forEach>
	</ul>
</div>
</div>